3DO Mill
for Grand Prix Legends
---

3DO Mill is a Binary Space Partition Tree creator, which generates 3DOs from raw mesh data. It's an alternative to ASE23DO, with fewer average polygon splits, and more features. These include Gouraud shading, OBJ file support, use of 0x7 and 0xa plane nodes, optional triangulation, accurate ear-clipping for concave polygons, and choice of display class.

Performance relative to ASE23DO varies. For 100 trackside objects tested, 3DO Mill produced 29% fewer triangles. The algorithm is stronger with untriangulated meshes, and was designed with TSOs in mind; I doubt it's suitable for large car meshes.

This first release reads ASE and OBJ files and is compatible with OneTwo3DO, 3ds Max, Blender, and Wings 3D. The download includes my ASE to OBJ/MTL converter for OneTwo3DO-format ASE.

-Credits
Hats off to Phil Flack for decoding and documenting GPL file formats.
For testing and supplying objects I'm indebted to: Ginetto, Dmitri Gavrilenko, Jim Pearson.
Written in C using the excellent freeware IDE "Pelles C".

-Execution
Simply drag and drop an ASE or OBJ file onto 3DO-Mill.exe, or type the following in command prompt:
3do-mill name.ase
If you want the 3DO split into triangles, type t as the third argument. For example:
3do-mill house.ase t
creates a 3DO from house.ase, converts all polygons to triangles, and saves as house.3do.
Display class can be set in OneTwo3DO, but for other formats you can pass it as the fourth argument. For example:
3do-mill bridge.obj - 8
sets display class to 8 and does not triangulate the object. The default display class is 3.
With OneTwo3DO, operation is simpler....

-OneTwo3DO
The download includes a modified OneTwo3DOm.exe which uses 3DO Mill automatically, with kind permission from Christian Wohlfahrt.
Copy OneTwo3DOm.exe and 3DO-Mill.exe into your OneTwo3DO folder, and run OneTwo3DOm.exe. This version should say v1.25* in the title bar. Load a project and select "Write ASE and convert to 3DO" as usual.

-Default triangulation
The 3DO-Mill.exe in the main folder does not convert the final 3DO to triangles by default; the one in the folder “alt version always triangulate” creates triangles only.  Either can be used with OneTwo3DO.  Retaining non-triangular polygons gives smaller 3DO size, but bear in mind....

-A GPL bug
If a polygon with more than 3 vertices has distorted texture mapping, the texture will tear if the polygon goes off the edge of the screen. This is a bug with GPL. It doesn't happen with ASE23DO, because ASE23DO creates only triangles. Solution: either remap the texture so the mapping vertices match the shape of the polygon, or divide the affected polygon into triangles in your modelling software, or get 3DO Mill to triangulate the whole object as described above.

-Clipping planes
To define your own clipping planes, make polygons in the planes you want and map a texture called "clipper". These polygons won't appear in the 3DO, but their planes will.

-OBJ format
GPL uses a z-up coordinate system. If your modelling software uses y-up, swap the y and z axes when you export the OBJ. Note that all polygons must be textured for 3DO Mill.

-Gouraud shading
If you want to apply vertex shading to your object, create a new file called name.lux in the same folder as name.ase (or name.obj), and open it in a text editor. The LUX format depends on the ASE format. If you're using OneTwo3DO or OBJ, the entries are:

POLYGON index flavour
VERTEX index red green blue alpha

E.g. to shade polygons 0 and 7:

POLYGON 0 820
VERTEX 0 110 255 0 255
VERTEX 1 110 255 0 255
VERTEX 2 255 255 0 120
POLYGON 7 820
VERTEX 0 200 40 230 255
VERTEX 1 200 40 230 255
VERTEX 2 100 20 115 255

If you're using 3ds Max, the entries are:

MESH "name"
FACE index flavour
VERTEX index red green blue alpha

E.g. to shade polygons 0 and 7 of the mesh “treerow”:

MESH "treerow"
FACE 0 820
VERTEX 0 110 255 0 255
VERTEX 1 110 255 0 255
VERTEX 2 255 255 0 120
FACE 7 820
VERTEX 0 200 40 230 255
VERTEX 1 200 40 230 255
VERTEX 2 100 20 115 255

The LUX format is quite particular:
1. Capital letters only, except mesh names which must match the ASE exactly, including quotes.
2. Polygons/meshes/faces must be listed in order.
3. Only list the polygons you want shaded.
4. Get the polygon and vertex numbers from OneTwo3DO etc. or read the ASE/OBJ file.
5. For Gouraud shading, flavour is 820.
6. Shading values are integers from 0 to 255.
7. If you skip a vertex it defaults to red=green=blue=alpha=255.
Note that shaded polygons are automatically converted to triangles to reduce flashing. Example LUX files are included in the package.

-Disclaimer
Don't blame me if your computer explodes and your hamster gets PTSD.

Phil Woodward, 7 August 2021.